package com.air.designmodel.ten;

/**
 * 假设缺鸭子对象,想用一些火鸡来冒充
 *
 * @author shent
 */
public class TurkeyAdapter implements Duck {
    Turkey turkey;

    public TurkeyAdapter(Turkey turkey) {
        this.turkey = turkey;
    }

    @Override
    public void quack() {
        turkey.gobble();
    }

    @Override
    public void fly() {
        //因为火鸡飞的没鸭子远,所以这里算飞5次等于鸭子飞一次
        for (int i = 0; i < 5; i++) {
            turkey.fly();
        }
    }
}
